clear all
close all
clc
tic
load('./temp/config.mat', 'config');

if config.if_server
    setenv('LD_LIBRARY_PATH', ['/usr/lib/x86_64-linux-gnu:/usr/local/lib:/usr/lib:' getenv('LD_LIBRARY_PATH')]);
end

config.res_pool_root = './temp/res_pool/';

config.res_type = 'jpg';

classifier_bank_path = dir( [config.sub_model_root  '*.yml'] );

if 1
    losses = computeLosses( config , classifier_bank_path);

    save( './temp/losses', 'losses' );
end

classifier_n = length( classifier_bank_path );
    
pairs = [];

for j1 = 1:classifier_n-1
    for j2 = j1+1:classifier_n
        pairs = [pairs; j1 j2];
    end
end

ord = randperm( size(pairs,1) );
    
ord = ord(1:classifier_n*5);

pairs = pairs(ord,:);

save('./temp/pairs','pairs');
    
probes = computeProbes( config, classifier_bank_path, pairs);

save( './temp/probes', 'probes' );